package com.right.health.app.net;

import com.right.health.app.constants.AppConfig;

import org.json.JSONException;
import org.json.JSONObject;

/*
 * Created by hopeliao on 2019-11-23
 *
 */
public class PageUtil {

     public static void addPageJson(JSONObject root, int page) {
        addPageJson(root, page, AppConfig.PAGE_SIZE);
     }

    public static void addPageJson(JSONObject root, int page, int pageSize) {
        JSONObject jsonObject = new JSONObject();
        try {
            jsonObject.put("pageNo", page);
            jsonObject.put("pageSize", pageSize);

            if(root != null) {
                root.put("page", jsonObject);
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }

    }
}
